#include <iostream>
#include <cstdio>
#include <cstring>
#include <cmath>
#include <cstdlib>
#include <algorithm>

using namespace std;

const int maxn=200005;

typedef long long ll;
struct Point{
    ll x,y;
    Point(const ll &_x=0,const ll &_y=0):x(_x),y(_y){}
    const Point operator - (const Point &p) const{return Point(x-p.x,y-p.y);}
};
Point pts[maxn];
int conv[maxn],pos[maxn];

inline ll cross(const Point &p,const Point &q){return p.x*q.y-p.y*q.x;}

template <typename T> inline void read(T &r){
    char c;bool f=0;
    for(c=getchar();c>'9'||c<'0';c=getchar()) if(c=='-') f=1;
    for(r=0;c<='9'&&c>='0';c=getchar()) r=r*10+c-'0';
    if(f) r=-r;
}

int seg[maxn*4];
inline int merge(const int &x,const int &y){
    if(pts[pos[x]].y==pts[pos[y]].y) return pts[pos[x]].x>pts[pos[y]].x?x:y;
    else return pts[pos[x]].y>pts[pos[y]].y?x:y;
}
inline void build(const int &p,const int &l,const int &r){
    if(l==r) seg[p]=l;
    else{
        int mid=(l+r)>>1;
        int lson=p<<1,rson=lson|1;
        build(lson,l,mid);
        build(rson,mid+1,r);
        seg[p]=merge(seg[lson],seg[rson]);
    }
}
int bg,ed;
inline int query(const int &p,const int &l,const int &r){
    if(l>=bg&&r<=ed) return seg[p];
    int mid=(l+r)>>1;
    if(ed<=mid) return query(p<<1,l,mid);
    else if(bg>mid) return query((p<<1)|1,mid+1,r);
    else return merge(query(p<<1,l,mid),query((p<<1)|1,mid+1,r));
}

int n;
int solve(const int &p){
    int high;
    bg=p;ed=pos[p];
    if(bg>ed) swap(bg,ed);
    high=query(1,1,n);
    if(high==p) return abs(pos[p]-p);
    return abs(high-p)+solve(high);
}

int main(){
    int con;

    freopen("mountain.in","r",stdin);
    //freopen("mountain.out","w",stdout);

    read(n);
    for(int i=1;i<=n;i++){
        read(pts[i].x);read(pts[i].y);
    }
    pos[1]=conv[1]=1;
    con=1;
    for(int i=2;i<=n;i++){
        while(con>=2&&cross(pts[conv[con]]-pts[conv[con-1]],pts[i]-pts[conv[con]])>0) con--;
        if(pts[i].y>=pts[conv[con]].y) pos[i]=i;
        else pos[i]=conv[con];
        conv[++con]=i;
    }

    conv[1]=n;
    con=1;
    for(int i=n-1;i;i--){
        while(con>=2&&cross(pts[conv[con]]-pts[conv[con-1]],pts[i]-pts[conv[con]])<0) con--;
        if(pts[pos[i]].y<=pts[conv[con]].y) pos[i]=conv[con];
        conv[++con]=i;
    }
    printf("%d,%d\n",pos[6],pos[5]);

    build(1,1,n);
    //for(int i=1;i<=n;i++) printf("%d ",pos[i]);putchar('\n');
    for(int i=1;i<=n;i++) printf("%d\n",solve(i));

    return 0;
}
